it = iter([1,2,3,4,5,6])
while True:
    try:
        x = next(it,'a')
        print(x)
        if x == 'a':
            break
    except StopIteration:
        #
        if x == 'a':
            break
